package com.cheung.leetcode.binarysearch;

public class LC268 {


    public static int missingNumber(int[] nums) {
        int n = nums.length;
        // 暴力解决
        boolean[] res = new boolean[n + 1];

        for (int num : nums) {
            res[num] = true;
        }

        for (int i = 0; i < res.length; i++) {
            if (!res[i]) {
                return i;
            }
        }

        return 0;
    }

    public static void main(String[] args) {
        int[] nums = {9,6,4,2,3,5,7,0,1};
        System.out.println(missingNumber(nums));
    }
}
